Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix generics resolving in method overloads search #937

Merged

Conversation

acizmarik
Copy link
Member

This PR fixes a bug that failed method overloads search, for example in the following case:

  • Suppose user created a method with given signature: T Method<T>(Enumerable<T> arg)
  • User called the method by passing an array T[] as the first and the only argument
  • DotVVM tries to resolve generic argument T based on typeof(T[]).GetGenericArguments() which fails for arrays

@acizmarik acizmarik added the bug label Feb 13, 2021
@acizmarik acizmarik added this to the Version 3.0 milestone Feb 13, 2021
Copy link
Member

@exyi exyi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, this is not worse than before. However this logic actually does not take implicit conversions into account at all, maybe we should fix that more generally. For example, this wont work:

interface A<T> { }
class B: A<int> { }

void Method<T>(I<T> x);

Invoking the Method(new B()) will fail.

@tomasherceg tomasherceg merged commit d3a1696 into main Feb 19, 2021
@tomasherceg tomasherceg deleted the bugfix/findoverload-generic-array-element-enumerable branch February 19, 2021 12:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants